//
//  NSString+ColorfulString.m
//  UILabel多种颜色
//
//  Created by Mac on 15/12/17.
//  Copyright © 2015年 Mac. All rights reserved.
//

#import "NSString+ColorfulString.h"

@implementation NSString (ColorfulString)

- (NSAttributedString *)colorfulStringWithFonts:(NSArray *)fontStyles {
    
   NSMutableAttributedString *attstr = [[NSMutableAttributedString alloc] initWithString:self];
    for (ZSFontStyle *tempFont in fontStyles) {
        [attstr addAttribute:NSForegroundColorAttributeName value:tempFont.fontColor range:tempFont.fontRange];
        [attstr addAttribute:NSFontAttributeName value:[UIFont fontWithName:tempFont.fontName size:tempFont.fontSize] range:tempFont.fontRange];
    }
    
    return attstr;
}

@end
